package com.learning.cloud.controller;

import com.learning.cloud.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * description:
 *
 * @author minghuiZhang
 * @date created in  15:28 2018/4/28
 * modified by
 */
@RestController
public class MovieController {
	@Autowired
	private RestTemplate restTemplate;

	@Value("${user.userServicePath}")
	private String userServicePath;
	@GetMapping("/movie/{id}")
	public ResponseEntity<User> findById(@PathVariable("id") Long id){
		return this.restTemplate.getForEntity( this.userServicePath + id,User.class);
	}
}
